package com.cyy.api.controller;

import com.cyy.common.domain.Response;
import com.cyy.common.pojo.req.FriendLinkApplyReq;
import com.cyy.common.service.FriendLinkService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * @author caoyunyou
 */
@Tag(name = "友情链接-API", description = "友情链接-API")
@RestController
@RequestMapping("/v1/friendLink")
@RequiredArgsConstructor
public class ApiFriendLinkController {

    private final FriendLinkService friendLinkService;

    @Operation(summary = "友情链接列表")
    @GetMapping("/list")
    public Response queryList() {
        return Response.success().data(friendLinkService.queryList());
    }

    @Operation(summary = "友链申请")
    @PostMapping("/apply")
    public Response apply(@RequestBody @Validated FriendLinkApplyReq req) {
        friendLinkService.apply(req);
        return Response.success();
    }
}
